package functional_programming;
class Dog {
    String name;
    int age = -1; // For "unknown"
    Dog() { name = "stray"; }
    Dog(String nm) { name = nm; }
    Dog(String nm, int yrs) { name = nm; age = yrs; }

    @Override
    public String toString() {
        return "Dog{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
interface NoArgs{
    Dog make();
}
interface OneArgs{
    Dog make1(String nm);
}
interface TwoArgss{
    Dog make2(String nm, int yrs);
}
public class CtorReference {
    public static void main(String[] args) {
        Dog dog = new Dog();
        NoArgs noArgs = Dog::new;
        OneArgs oneArgs = Dog::new;
        TwoArgss two = Dog::new;
        Dog make = noArgs.make();
        Dog one = oneArgs.make1("one");
        Dog two1 = two.make2("two", 2);
        System.out.println(make);
        System.out.println(one);
        System.out.println(two1);
    }
}
